package my.app.add;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.widget.Toast;

public class PackageReceiver extends BroadcastReceiver{

    @Override
    public void onReceive(Context context, Intent intent) {
        if(Intent.ACTION_PACKAGE_ADDED.equals(intent.getAction())) {
                String packageName = intent.getDataString().substring(8);
                Toast.makeText(context, packageName,Toast.LENGTH_SHORT).show();
                Log.i("pop", "-----有应用被添加,新增应用包名是------" + packageName);
        }
    }

}
